package com.runjian.rundo.iot.agent.iec104.parser.frame;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * 单点遥控信息
 */
@Getter
@Setter
public class SinglePointRemoteControl extends PointRemoteControl {

    public SinglePointRemoteControl(byte data) {
        super((data & 0xff & 0x80) == 128, (data & 0xff & 0x01));
    }

    public SinglePointRemoteControl(boolean type, int status) {
        super(type, status);
    }

    @Override
    public String console() {
        return StrUtil.format(" 遥控单点对象: {}   {}", this.isType() ? "遥控选择指令" : "遥控执行指令", getStatusStr());
    }

    @Override
    public String getStatusStr() {
        switch (this.getStatus()) {
            case 0:
                return "开关分";
            case 1:
                return "开关合";
        }
        return "";
    }

}
